import { BaseModel } from '@/common/base/base.model';
import { Column, Entity } from 'typeorm';
import { CarouselMobileJumpType, CarouselPositionCode } from "common/utils/data";

@Entity('CAROUSEL', {
  synchronize: false,
}) // 轮播
export class CarouselModel extends BaseModel {
  @Column({
    comment: '状态（1：启用，0：禁用）',
    type: 'smallint',
    default: 1,
  })
  status: number;

  @Column({
    comment: '标题',
    type: 'varchar',
    length: 500,
  })
  title: string;

  @Column({
    comment: '图片url',
    type: 'varchar',
    length: 500,
  })
  img: string;

  @Column({
    comment: '跳转链接',
    type: 'varchar',
    length: 500,
  })
  url: string;

  @Column({
    comment: '描述',
    type: 'varchar',
    length: 500,
  })
  desc: string;

  @Column({
    comment: '排序',
    type: 'int',
    default: 1,
  })
  sort: number;

  @Column({
    comment: '移动端跳转类型',
    type: 'varchar',
    length: 50,
    default: CarouselMobileJumpType.NONE,
  })
  mobileJumpType: CarouselMobileJumpType;

  @Column({
    comment: '移动端跳转id',
    type: 'varchar',
    length: 50,
    default: '',
  })
  mobileJumpId: string;

  @Column({
    comment: '移动端跳转扩展参数',
    type: 'json',
    default: {},
  })
  mobileJumpExtra: any;

  @Column({
    comment: '广告位code',
    type: 'varchar',
    length: 50,
  })
  positionCode: CarouselPositionCode;
}
